{
  "properties" : { },
  "id" : "12ec75f6d06d4771ae3b7a620db6961b",
  "script" : null,
  "groupId" : "a7109e8f35c343dfa8220583ef254707",
  "name" : "删除",
  "createTime" : 1714063371982,
  "updateTime" : 1711898005086,
  "lock" : null,
  "createBy" : "管理员",
  "updateBy" : "管理员",
  "path" : "remove",
  "method" : "DELETE",
  "parameters" : [ {
    "name" : "id",
    "value" : null,
    "description" : null,
    "required" : false,
    "dataType" : "Integer",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ {
    "name" : "role",
    "value" : "root",
    "description" : "允许拥有该角色的访问",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "requestBody" : "{\r\n    \"id\": 100\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import com.gitee.fastmybatis.core.query.Query;

import 'com.wiwf.model.mapper.admin.dao.SysMenuMapper' as sysMenuMapper;
import 'com.wiwf.model.mapper.admin.dao.SysRoleMenuMapper' as sysRoleMenuMapper;

var menuId = id != null? id: body.id;
Query query = new Query().eq("parent_id", menuId);

if(sysMenuMapper.getCount(query) > 0){
    exit 401, "包含子节点的菜单不能删除！"
}

Query query = new Query().eq('menu_id', menuId);
sysRoleMenuMapper.deleteByQuery(query, null);

return sysMenuMapper.deleteById(menuId);